package com.mshopping.app.ui;

import android.os.Bundle;
import android.widget.TextView;

import com.mshopping.app.R;
import com.mshopping.app.configs.Configs;
import com.mshopping.app.entity.User;
import com.mshopping.app.manager.GlobleManager;
import com.mshopping.app.ui.base.BaseActivity;

public class MainActivity extends BaseActivity {

	private User user              = null;

	private TextView txt_username  = null;
	private TextView txt_id        = null;
	private TextView txt_grade     = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		initData();
		findView();
		initView();
	}

	private void initData() {
		user = (User) GlobleManager.getInstance().get(Configs.KEY_USER);
	}

	private void findView() {
		txt_id = (TextView) findViewById(R.id.txt_id);
		txt_username = (TextView) findViewById(R.id.txt_name);
		txt_grade=(TextView) findViewById(R.id.txt_grade);
	}

	private void initView() {
		txt_id.setText(user.getId() + "");
		txt_username.setText(user.getName());
		txt_grade.setText(user.getGrade()+"");
	}

}
